package org.jeecg.modules.tls.oes.exam.service.impl;

import org.jeecg.modules.tls.oes.exam.entity.OesExam;
import org.jeecg.modules.tls.oes.exam.mapper.OesExamMapper;
import org.jeecg.modules.tls.oes.exam.service.IOesExamService;
import org.jeecg.modules.tls.oes.paper.service.IOesPaperService;
import org.jeecg.modules.tls.oes.viewmodel.admin.exam.ExamRequestVM;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 * @Description: oes_exam
 * @Author: jeecg-boot
 * @Date:   2022-07-18
 * @Version: V1.0
 */
@Service
public class OesExamServiceImpl extends ServiceImpl<OesExamMapper, OesExam> implements IOesExamService {
    @Autowired
    OesExamMapper oesExamMapper;
    @Autowired
    IOesPaperService iOesPaperService;

    @Override
    public ExamRequestVM getExamRequestVM(String id) {
        //获取该id的考试信息
        ExamRequestVM examRequestVM = new ExamRequestVM();
        OesExam oesExam = oesExamMapper.selectById(id);
        //设置考试VM
        examRequestVM.setId(oesExam.getId());
        examRequestVM.setName(oesExam.getName());
        examRequestVM.setPaperId(oesExam.getPaperId());
        examRequestVM.setLimiteStartTime(oesExam.getLimitStartTime());
        examRequestVM.setLimiteEndTime(oesExam.getLimitEndTime());
        examRequestVM.setSuggestTime(oesExam.getSuggestTime());
        examRequestVM.setPaper(iOesPaperService.getExamPaperRequestVM(oesExam.getPaperId()));
        return examRequestVM;
    }
}
